<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" href="jquery-ui-1.10.4/jquery-ui-1.10.4/themes/base/jquery.ui.all.css">
        <script src="jquery-ui-1.10.4/jquery-ui-1.10.4/jquery-1.10.2.js"></script>
        <script src="jquery-ui-1.10.4/jquery-ui-1.10.4/ui/jquery.ui.core.js"></script>
        <script src="jquery-ui-1.10.4/jquery-ui-1.10.4/ui/jquery.ui.widget.js"></script>
        <script src="jquery-ui-1.10.4/jquery-ui-1.10.4/ui/jquery.ui.position.js"></script>
        <script src="jquery-ui-1.10.4/jquery-ui-1.10.4/ui/jquery.ui.menu.js"></script>
        <link rel="stylesheet" href="jquery-ui-1.10.4/jquery-ui-1.10.4/demos/demos.css">
        <script>
            $(function() {
                $( "#menu" ).menu();
            });
        </script>
        <style>
            .ui-menu { width: 200px; border:none;

            }
        </style>
    </head>
    <body>
        <div id="sidebar">
            <div class="cart">
                <?php
                if (isset($_SESSION['cart'])) {
                    ?>
                    <a href="cart.php"> <img src="public/templates/admin/images/interface/shopping_cart.png" alt="cart-icon"/></a>  <a href="cart.php">Cart: </a><a href="cart.php"><?php echo count($_SESSION['cart']) ?>(sản phẩm)</a>
                    <?php
                } else {
                    ?>
                    <a href="cart.php"> <img src="public/templates/admin/images/interface/shopping_cart.png" alt="cart-icon"/></a>  <a href="cart.php">Cart: </a><a href="cart.php">0(sản phẩm)</a>
                    <?php
                }
                ?>

            </div>
            <h2>Sản phẩm</h2>
            <ul id="menu">
                <?php
                $conn = mysql_connect('localhost', 'root', '') or die("Not connect to database");
                mysql_select_db('fashion', $conn) or die("not select to database");
                mysql_set_charset('utf8', $conn);
                $parrent_sql = "SELECT * FROM categories";
                $result = mysql_query($parrent_sql, $conn);
                if (mysql_num_rows($result) > 0) {
                    while ($page_cha = mysql_fetch_assoc($result)) {
                        $child_sql = "SELECT * FROM categories_small WHERE cate_id = {$page_cha['cate_id']}";
                        $child_result = mysql_query($child_sql, $conn);
                        if (mysql_num_rows($child_result) > 0) {
                            ?>
                            <li><a href="product.php?cate_id=<?php echo $page_cha['cate_id'] ?>"><?php echo $page_cha['cate_name'] ?></a>
                                <ul>
                                    <?php
                                    while ($page_con = mysql_fetch_assoc($child_result)) {
                                        ?>
                                        <li><a href="product2.php?cates_id=<?php echo $page_con['cates_id'] ?>"><?php echo $page_con['cates_name'] ?></a></li>
                                        <?php
                                    }
                                    ?>
                                </ul>
                            </li>
                            <?php
                        } else {
                            ?>
                            <li><a href="product.php?cate_id=<?php echo $page_cha['cate_id'] ?>"><?php echo $page_cha['cate_name'] ?></a></li>
                            <?php
                        }
                    }
                }
                mysql_close($conn);
                ?>
            </ul>
            <h2>Mức giá </h2>
            <ul class="price">
                <?php
                $price = array();
                $price[0] = "Dưới 100,000";
                $price[1] = "Từ 100,000-200,000";
                $price[2] = "Từ 200,000-400,000";
                $price[3] = "Từ 400,000-700,000";
                $price[4] = "Trên 700,000";
                for ($i = 0; $i < count($price); $i++) {
                    ?>
                    <li><a href="search-detail.php?search=<?php echo $i ?>"><?php echo $price[$i] ?></a>
                        <?php
                    }
                    ?>
            </ul>
            <h2>Quảng cáo</h2>
           

        </div><!--END #sidebar-->
    </body>
</html>
